//
//  NewsViewController.m
//  MyLittleBrother
//
//  Created by speeda on 17/7/31.
//  Copyright © 2017年 speeda. All rights reserved.
//

#import "NewsViewController.h"
#import "NewsCell.h"

@interface NewsViewController () <UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *newsTableView;
@property (nonatomic, strong) NSMutableArray *newsArray;

@end

@implementation NewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initView];
}

- (void)initView {

    self.title = @"通知";
    
    self.newsTableView.dataSource = self;
    self.newsTableView.delegate = self;
    self.newsTableView.tableFooterView = [[UIView alloc] init];
    self.newsTableView.estimatedRowHeight = 100;
    self.newsTableView.rowHeight = UITableViewAutomaticDimension;
    self.newsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}





#pragma mark -- UITableViewDataSource,UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 10;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *cellID = @"NewsCell";
    NewsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        NSArray *nibs = [[NSBundle mainBundle] loadNibNamed:@"NewsCell" owner:nil options:nil];
        cell = [nibs lastObject];
    }
    
    return cell;
}

- (NSMutableArray *)newsArray {

    if (!_newsArray) {
        _newsArray = [NSMutableArray array];
    }
    
    return _newsArray;
}

@end
